package de.hauschild.gmltracer.gml.impl.value.geometry;

import de.hauschild.gmltracer.gml.Environment;
import de.hauschild.gmltracer.gml.TokenStack;
import de.hauschild.gmltracer.gml.impl.AbstractToken;
import de.hauschild.gmltracer.gml.impl.control.FunctionToken;
import de.hauschild.gmltracer.tracer.Shape;

public abstract class ShapeOperatorToken<T extends Shape> extends AbstractToken {

  @Override
  public void evaluate(final Environment environment, final TokenStack tokenStack) {
    final FunctionToken surfaceFunction = tokenStack.pop(FunctionToken.class);
    tokenStack.push(createShape((FunctionToken) surfaceFunction.cloneToken()));
  }

  protected abstract ShapeToken<T> createShape(FunctionToken sureface);
}
